#include<bits/stdc++.h>
using namespace std;
#define int long long
int read(){
    int sum=0,k=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')k=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        sum=sum*10+(ch-'0');
        ch=getchar();
    }
    return sum*k;
}
void print(int x){
    if(x<0)putchar('-'),x=-x;
    if(x<=9)putchar(x+'0');
    else{
        print(x/10);
        putchar(x%10+'0');
    }
}
const int N=1e5+5;
int vis[N];
signed main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n=read();
    int ans=0;
    int maxn=0;
    for(int i=1;i<=n;i++){
        int x=read();
        maxn=max(maxn,x);
        if(vis[x])ans++;
        vis[x]++;
    }
    if(maxn==2)print(max(vis[1],vis[2]));
    else print(ans);
    return 0;
}
